# frozen_string_literal: true

class DecisionTableCell < ApplicationRecord
  extend Ordinalable

  belongs_to :decision_table_row
  has_one :decision_table, through: :decision_table_row

  class << self
    def dt_column_name(variable_type)
      column_types = {
        'integer' => 'int_value',
        'boolean' => 'bool_value',
        'float' => 'decimal_value',
        'decimal' => 'decimal_value',
        'date' => 'date_value',
        'datetime' => 'date_value',
        'string' => 'str_value'
      }.freeze

      column_types[variable_type] || 'str_value'
    end
  end
end
